Left Termination of the query pattern search_tree_in_1(g) w.r.t. the given Prolog program could successfully be proven:



Prolog
  ↳ PrologToPiTRSProof

Clauses:

search_tree(void).
search_tree(T) :- search_tree(T, X, X1).
search_tree(tree(X, void, void), X, X).
search_tree(tree(X, void, Right), X, Max) :- ','(search_tree(Right, Min, Max), less(X, Min)).
search_tree(tree(X, Left, void), Min, X) :- ','(search_tree(Left, Min, Max), less(Max, X)).
search_tree(tree(X, Left, Right), Min1, Max2) :- ','(search_tree(Left, Min1, Max1), ','(less(Max1, X), ','(search_tree(Right, Min2, Max2), less(X, Min2)))).
less(0, s(X)).
less(s(X), s(Y)) :- less(X, Y).

Queries:

search_tree(g).

We use the technique of [30]. With regard to the inferred argument filtering the predicates were used in the following modes:
search_tree_in: (b)
search_tree_in: (b,f,f)
less_in: (b,b)
Transforming Prolog into the following Term Rewriting System:
Pi-finite rewrite system:
The TRS R consists of the following rules:

search_tree_in_g(void) → search_tree_out_g(void)
search_tree_in_g(T) → U1_g(T, search_tree_in_gaa(T, X, X1))
search_tree_in_gaa(tree(X, void, void), X, X) → search_tree_out_gaa(tree(X, void, void), X, X)
search_tree_in_gaa(tree(X, void, Right), X, Max) → U2_gaa(X, Right, Max, search_tree_in_gaa(Right, Min, Max))
search_tree_in_gaa(tree(X, Left, void), Min, X) → U4_gaa(X, Left, Min, search_tree_in_gaa(Left, Min, Max))
search_tree_in_gaa(tree(X, Left, Right), Min1, Max2) → U6_gaa(X, Left, Right, Min1, Max2, search_tree_in_gaa(Left, Min1, Max1))
U6_gaa(X, Left, Right, Min1, Max2, search_tree_out_gaa(Left, Min1, Max1)) → U7_gaa(X, Left, Right, Min1, Max2, Max1, less_in_gg(Max1, X))
less_in_gg(0, s(X)) → less_out_gg(0, s(X))
less_in_gg(s(X), s(Y)) → U10_gg(X, Y, less_in_gg(X, Y))
U10_gg(X, Y, less_out_gg(X, Y)) → less_out_gg(s(X), s(Y))
U7_gaa(X, Left, Right, Min1, Max2, Max1, less_out_gg(Max1, X)) → U8_gaa(X, Left, Right, Min1, Max2, search_tree_in_gaa(Right, Min2, Max2))
U8_gaa(X, Left, Right, Min1, Max2, search_tree_out_gaa(Right, Min2, Max2)) → U9_gaa(X, Left, Right, Min1, Max2, less_in_gg(X, Min2))
U9_gaa(X, Left, Right, Min1, Max2, less_out_gg(X, Min2)) → search_tree_out_gaa(tree(X, Left, Right), Min1, Max2)
U4_gaa(X, Left, Min, search_tree_out_gaa(Left, Min, Max)) → U5_gaa(X, Left, Min, less_in_gg(Max, X))
U5_gaa(X, Left, Min, less_out_gg(Max, X)) → search_tree_out_gaa(tree(X, Left, void), Min, X)
U2_gaa(X, Right, Max, search_tree_out_gaa(Right, Min, Max)) → U3_gaa(X, Right, Max, less_in_gg(X, Min))
U3_gaa(X, Right, Max, less_out_gg(X, Min)) → search_tree_out_gaa(tree(X, void, Right), X, Max)
U1_g(T, search_tree_out_gaa(T, X, X1)) → search_tree_out_g(T)

The argument filtering Pi contains the following mapping:
search_tree_in_g(x1)  =  search_tree_in_g(x1)
void  =  void
search_tree_out_g(x1)  =  search_tree_out_g
U1_g(x1, x2)  =  U1_g(x2)
search_tree_in_gaa(x1, x2, x3)  =  search_tree_in_gaa(x1)
tree(x1, x2, x3)  =  tree(x1, x2, x3)
search_tree_out_gaa(x1, x2, x3)  =  search_tree_out_gaa(x2, x3)
U2_gaa(x1, x2, x3, x4)  =  U2_gaa(x1, x4)
U4_gaa(x1, x2, x3, x4)  =  U4_gaa(x1, x4)
U6_gaa(x1, x2, x3, x4, x5, x6)  =  U6_gaa(x1, x3, x6)
U7_gaa(x1, x2, x3, x4, x5, x6, x7)  =  U7_gaa(x1, x3, x4, x7)
less_in_gg(x1, x2)  =  less_in_gg(x1, x2)
0  =  0
s(x1)  =  s(x1)
less_out_gg(x1, x2)  =  less_out_gg
U10_gg(x1, x2, x3)  =  U10_gg(x3)
U8_gaa(x1, x2, x3, x4, x5, x6)  =  U8_gaa(x1, x4, x6)
U9_gaa(x1, x2, x3, x4, x5, x6)  =  U9_gaa(x4, x5, x6)
U5_gaa(x1, x2, x3, x4)  =  U5_gaa(x1, x3, x4)
U3_gaa(x1, x2, x3, x4)  =  U3_gaa(x1, x3, x4)

Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog



↳ Prolog
  ↳ PrologToPiTRSProof
PiTRS
      ↳ DependencyPairsProof

Pi-finite rewrite system:
The TRS R consists of the following rules:

search_tree_in_g(void) → search_tree_out_g(void)
search_tree_in_g(T) → U1_g(T, search_tree_in_gaa(T, X, X1))
search_tree_in_gaa(tree(X, void, void), X, X) → search_tree_out_gaa(tree(X, void, void), X, X)
search_tree_in_gaa(tree(X, void, Right), X, Max) → U2_gaa(X, Right, Max, search_tree_in_gaa(Right, Min, Max))
search_tree_in_gaa(tree(X, Left, void), Min, X) → U4_gaa(X, Left, Min, search_tree_in_gaa(Left, Min, Max))
search_tree_in_gaa(tree(X, Left, Right), Min1, Max2) → U6_gaa(X, Left, Right, Min1, Max2, search_tree_in_gaa(Left, Min1, Max1))
U6_gaa(X, Left, Right, Min1, Max2, search_tree_out_gaa(Left, Min1, Max1)) → U7_gaa(X, Left, Right, Min1, Max2, Max1, less_in_gg(Max1, X))
less_in_gg(0, s(X)) → less_out_gg(0, s(X))
less_in_gg(s(X), s(Y)) → U10_gg(X, Y, less_in_gg(X, Y))
U10_gg(X, Y, less_out_gg(X, Y)) → less_out_gg(s(X), s(Y))
U7_gaa(X, Left, Right, Min1, Max2, Max1, less_out_gg(Max1, X)) → U8_gaa(X, Left, Right, Min1, Max2, search_tree_in_gaa(Right, Min2, Max2))
U8_gaa(X, Left, Right, Min1, Max2, search_tree_out_gaa(Right, Min2, Max2)) → U9_gaa(X, Left, Right, Min1, Max2, less_in_gg(X, Min2))
U9_gaa(X, Left, Right, Min1, Max2, less_out_gg(X, Min2)) → search_tree_out_gaa(tree(X, Left, Right), Min1, Max2)
U4_gaa(X, Left, Min, search_tree_out_gaa(Left, Min, Max)) → U5_gaa(X, Left, Min, less_in_gg(Max, X))
U5_gaa(X, Left, Min, less_out_gg(Max, X)) → search_tree_out_gaa(tree(X, Left, void), Min, X)
U2_gaa(X, Right, Max, search_tree_out_gaa(Right, Min, Max)) → U3_gaa(X, Right, Max, less_in_gg(X, Min))
U3_gaa(X, Right, Max, less_out_gg(X, Min)) → search_tree_out_gaa(tree(X, void, Right), X, Max)
U1_g(T, search_tree_out_gaa(T, X, X1)) → search_tree_out_g(T)

The argument filtering Pi contains the following mapping:
search_tree_in_g(x1)  =  search_tree_in_g(x1)
void  =  void
search_tree_out_g(x1)  =  search_tree_out_g
U1_g(x1, x2)  =  U1_g(x2)
search_tree_in_gaa(x1, x2, x3)  =  search_tree_in_gaa(x1)
tree(x1, x2, x3)  =  tree(x1, x2, x3)
search_tree_out_gaa(x1, x2, x3)  =  search_tree_out_gaa(x2, x3)
U2_gaa(x1, x2, x3, x4)  =  U2_gaa(x1, x4)
U4_gaa(x1, x2, x3, x4)  =  U4_gaa(x1, x4)
U6_gaa(x1, x2, x3, x4, x5, x6)  =  U6_gaa(x1, x3, x6)
U7_gaa(x1, x2, x3, x4, x5, x6, x7)  =  U7_gaa(x1, x3, x4, x7)
less_in_gg(x1, x2)  =  less_in_gg(x1, x2)
0  =  0
s(x1)  =  s(x1)
less_out_gg(x1, x2)  =  less_out_gg
U10_gg(x1, x2, x3)  =  U10_gg(x3)
U8_gaa(x1, x2, x3, x4, x5, x6)  =  U8_gaa(x1, x4, x6)
U9_gaa(x1, x2, x3, x4, x5, x6)  =  U9_gaa(x4, x5, x6)
U5_gaa(x1, x2, x3, x4)  =  U5_gaa(x1, x3, x4)
U3_gaa(x1, x2, x3, x4)  =  U3_gaa(x1, x3, x4)


Using Dependency Pairs [1,30] we result in the following initial DP problem:
Pi DP problem:
The TRS P consists of the following rules:

SEARCH_TREE_IN_G(T) → U1_G(T, search_tree_in_gaa(T, X, X1))
SEARCH_TREE_IN_G(T) → SEARCH_TREE_IN_GAA(T, X, X1)
SEARCH_TREE_IN_GAA(tree(X, void, Right), X, Max) → U2_GAA(X, Right, Max, search_tree_in_gaa(Right, Min, Max))
SEARCH_TREE_IN_GAA(tree(X, void, Right), X, Max) → SEARCH_TREE_IN_GAA(Right, Min, Max)
SEARCH_TREE_IN_GAA(tree(X, Left, void), Min, X) → U4_GAA(X, Left, Min, search_tree_in_gaa(Left, Min, Max))
SEARCH_TREE_IN_GAA(tree(X, Left, void), Min, X) → SEARCH_TREE_IN_GAA(Left, Min, Max)
SEARCH_TREE_IN_GAA(tree(X, Left, Right), Min1, Max2) → U6_GAA(X, Left, Right, Min1, Max2, search_tree_in_gaa(Left, Min1, Max1))
SEARCH_TREE_IN_GAA(tree(X, Left, Right), Min1, Max2) → SEARCH_TREE_IN_GAA(Left, Min1, Max1)
U6_GAA(X, Left, Right, Min1, Max2, search_tree_out_gaa(Left, Min1, Max1)) → U7_GAA(X, Left, Right, Min1, Max2, Max1, less_in_gg(Max1, X))
U6_GAA(X, Left, Right, Min1, Max2, search_tree_out_gaa(Left, Min1, Max1)) → LESS_IN_GG(Max1, X)
LESS_IN_GG(s(X), s(Y)) → U10_GG(X, Y, less_in_gg(X, Y))
LESS_IN_GG(s(X), s(Y)) → LESS_IN_GG(X, Y)
U7_GAA(X, Left, Right, Min1, Max2, Max1, less_out_gg(Max1, X)) → U8_GAA(X, Left, Right, Min1, Max2, search_tree_in_gaa(Right, Min2, Max2))
U7_GAA(X, Left, Right, Min1, Max2, Max1, less_out_gg(Max1, X)) → SEARCH_TREE_IN_GAA(Right, Min2, Max2)
U8_GAA(X, Left, Right, Min1, Max2, search_tree_out_gaa(Right, Min2, Max2)) → U9_GAA(X, Left, Right, Min1, Max2, less_in_gg(X, Min2))
U8_GAA(X, Left, Right, Min1, Max2, search_tree_out_gaa(Right, Min2, Max2)) → LESS_IN_GG(X, Min2)
U4_GAA(X, Left, Min, search_tree_out_gaa(Left, Min, Max)) → U5_GAA(X, Left, Min, less_in_gg(Max, X))
U4_GAA(X, Left, Min, search_tree_out_gaa(Left, Min, Max)) → LESS_IN_GG(Max, X)
U2_GAA(X, Right, Max, search_tree_out_gaa(Right, Min, Max)) → U3_GAA(X, Right, Max, less_in_gg(X, Min))
U2_GAA(X, Right, Max, search_tree_out_gaa(Right, Min, Max)) → LESS_IN_GG(X, Min)

The TRS R consists of the following rules:

search_tree_in_g(void) → search_tree_out_g(void)
search_tree_in_g(T) → U1_g(T, search_tree_in_gaa(T, X, X1))
search_tree_in_gaa(tree(X, void, void), X, X) → search_tree_out_gaa(tree(X, void, void), X, X)
search_tree_in_gaa(tree(X, void, Right), X, Max) → U2_gaa(X, Right, Max, search_tree_in_gaa(Right, Min, Max))
search_tree_in_gaa(tree(X, Left, void), Min, X) → U4_gaa(X, Left, Min, search_tree_in_gaa(Left, Min, Max))
search_tree_in_gaa(tree(X, Left, Right), Min1, Max2) → U6_gaa(X, Left, Right, Min1, Max2, search_tree_in_gaa(Left, Min1, Max1))
U6_gaa(X, Left, Right, Min1, Max2, search_tree_out_gaa(Left, Min1, Max1)) → U7_gaa(X, Left, Right, Min1, Max2, Max1, less_in_gg(Max1, X))
less_in_gg(0, s(X)) → less_out_gg(0, s(X))
less_in_gg(s(X), s(Y)) → U10_gg(X, Y, less_in_gg(X, Y))
U10_gg(X, Y, less_out_gg(X, Y)) → less_out_gg(s(X), s(Y))
U7_gaa(X, Left, Right, Min1, Max2, Max1, less_out_gg(Max1, X)) → U8_gaa(X, Left, Right, Min1, Max2, search_tree_in_gaa(Right, Min2, Max2))
U8_gaa(X, Left, Right, Min1, Max2, search_tree_out_gaa(Right, Min2, Max2)) → U9_gaa(X, Left, Right, Min1, Max2, less_in_gg(X, Min2))
U9_gaa(X, Left, Right, Min1, Max2, less_out_gg(X, Min2)) → search_tree_out_gaa(tree(X, Left, Right), Min1, Max2)
U4_gaa(X, Left, Min, search_tree_out_gaa(Left, Min, Max)) → U5_gaa(X, Left, Min, less_in_gg(Max, X))
U5_gaa(X, Left, Min, less_out_gg(Max, X)) → search_tree_out_gaa(tree(X, Left, void), Min, X)
U2_gaa(X, Right, Max, search_tree_out_gaa(Right, Min, Max)) → U3_gaa(X, Right, Max, less_in_gg(X, Min))
U3_gaa(X, Right, Max, less_out_gg(X, Min)) → search_tree_out_gaa(tree(X, void, Right), X, Max)
U1_g(T, search_tree_out_gaa(T, X, X1)) → search_tree_out_g(T)

The argument filtering Pi contains the following mapping:
search_tree_in_g(x1)  =  search_tree_in_g(x1)
void  =  void
search_tree_out_g(x1)  =  search_tree_out_g
U1_g(x1, x2)  =  U1_g(x2)
search_tree_in_gaa(x1, x2, x3)  =  search_tree_in_gaa(x1)
tree(x1, x2, x3)  =  tree(x1, x2, x3)
search_tree_out_gaa(x1, x2, x3)  =  search_tree_out_gaa(x2, x3)
U2_gaa(x1, x2, x3, x4)  =  U2_gaa(x1, x4)
U4_gaa(x1, x2, x3, x4)  =  U4_gaa(x1, x4)
U6_gaa(x1, x2, x3, x4, x5, x6)  =  U6_gaa(x1, x3, x6)
U7_gaa(x1, x2, x3, x4, x5, x6, x7)  =  U7_gaa(x1, x3, x4, x7)
less_in_gg(x1, x2)  =  less_in_gg(x1, x2)
0  =  0
s(x1)  =  s(x1)
less_out_gg(x1, x2)  =  less_out_gg
U10_gg(x1, x2, x3)  =  U10_gg(x3)
U8_gaa(x1, x2, x3, x4, x5, x6)  =  U8_gaa(x1, x4, x6)
U9_gaa(x1, x2, x3, x4, x5, x6)  =  U9_gaa(x4, x5, x6)
U5_gaa(x1, x2, x3, x4)  =  U5_gaa(x1, x3, x4)
U3_gaa(x1, x2, x3, x4)  =  U3_gaa(x1, x3, x4)
SEARCH_TREE_IN_G(x1)  =  SEARCH_TREE_IN_G(x1)
U7_GAA(x1, x2, x3, x4, x5, x6, x7)  =  U7_GAA(x1, x3, x4, x7)
U3_GAA(x1, x2, x3, x4)  =  U3_GAA(x1, x3, x4)
U1_G(x1, x2)  =  U1_G(x2)
U4_GAA(x1, x2, x3, x4)  =  U4_GAA(x1, x4)
U8_GAA(x1, x2, x3, x4, x5, x6)  =  U8_GAA(x1, x4, x6)
U9_GAA(x1, x2, x3, x4, x5, x6)  =  U9_GAA(x4, x5, x6)
U5_GAA(x1, x2, x3, x4)  =  U5_GAA(x1, x3, x4)
LESS_IN_GG(x1, x2)  =  LESS_IN_GG(x1, x2)
U6_GAA(x1, x2, x3, x4, x5, x6)  =  U6_GAA(x1, x3, x6)
U10_GG(x1, x2, x3)  =  U10_GG(x3)
SEARCH_TREE_IN_GAA(x1, x2, x3)  =  SEARCH_TREE_IN_GAA(x1)
U2_GAA(x1, x2, x3, x4)  =  U2_GAA(x1, x4)

We have to consider all (P,R,Pi)-chains

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
PiDP
          ↳ DependencyGraphProof

Pi DP problem:
The TRS P consists of the following rules:

SEARCH_TREE_IN_G(T) → U1_G(T, search_tree_in_gaa(T, X, X1))
SEARCH_TREE_IN_G(T) → SEARCH_TREE_IN_GAA(T, X, X1)
SEARCH_TREE_IN_GAA(tree(X, void, Right), X, Max) → U2_GAA(X, Right, Max, search_tree_in_gaa(Right, Min, Max))
SEARCH_TREE_IN_GAA(tree(X, void, Right), X, Max) → SEARCH_TREE_IN_GAA(Right, Min, Max)
SEARCH_TREE_IN_GAA(tree(X, Left, void), Min, X) → U4_GAA(X, Left, Min, search_tree_in_gaa(Left, Min, Max))
SEARCH_TREE_IN_GAA(tree(X, Left, void), Min, X) → SEARCH_TREE_IN_GAA(Left, Min, Max)
SEARCH_TREE_IN_GAA(tree(X, Left, Right), Min1, Max2) → U6_GAA(X, Left, Right, Min1, Max2, search_tree_in_gaa(Left, Min1, Max1))
SEARCH_TREE_IN_GAA(tree(X, Left, Right), Min1, Max2) → SEARCH_TREE_IN_GAA(Left, Min1, Max1)
U6_GAA(X, Left, Right, Min1, Max2, search_tree_out_gaa(Left, Min1, Max1)) → U7_GAA(X, Left, Right, Min1, Max2, Max1, less_in_gg(Max1, X))
U6_GAA(X, Left, Right, Min1, Max2, search_tree_out_gaa(Left, Min1, Max1)) → LESS_IN_GG(Max1, X)
LESS_IN_GG(s(X), s(Y)) → U10_GG(X, Y, less_in_gg(X, Y))
LESS_IN_GG(s(X), s(Y)) → LESS_IN_GG(X, Y)
U7_GAA(X, Left, Right, Min1, Max2, Max1, less_out_gg(Max1, X)) → U8_GAA(X, Left, Right, Min1, Max2, search_tree_in_gaa(Right, Min2, Max2))
U7_GAA(X, Left, Right, Min1, Max2, Max1, less_out_gg(Max1, X)) → SEARCH_TREE_IN_GAA(Right, Min2, Max2)
U8_GAA(X, Left, Right, Min1, Max2, search_tree_out_gaa(Right, Min2, Max2)) → U9_GAA(X, Left, Right, Min1, Max2, less_in_gg(X, Min2))
U8_GAA(X, Left, Right, Min1, Max2, search_tree_out_gaa(Right, Min2, Max2)) → LESS_IN_GG(X, Min2)
U4_GAA(X, Left, Min, search_tree_out_gaa(Left, Min, Max)) → U5_GAA(X, Left, Min, less_in_gg(Max, X))
U4_GAA(X, Left, Min, search_tree_out_gaa(Left, Min, Max)) → LESS_IN_GG(Max, X)
U2_GAA(X, Right, Max, search_tree_out_gaa(Right, Min, Max)) → U3_GAA(X, Right, Max, less_in_gg(X, Min))
U2_GAA(X, Right, Max, search_tree_out_gaa(Right, Min, Max)) → LESS_IN_GG(X, Min)

The TRS R consists of the following rules:

search_tree_in_g(void) → search_tree_out_g(void)
search_tree_in_g(T) → U1_g(T, search_tree_in_gaa(T, X, X1))
search_tree_in_gaa(tree(X, void, void), X, X) → search_tree_out_gaa(tree(X, void, void), X, X)
search_tree_in_gaa(tree(X, void, Right), X, Max) → U2_gaa(X, Right, Max, search_tree_in_gaa(Right, Min, Max))
search_tree_in_gaa(tree(X, Left, void), Min, X) → U4_gaa(X, Left, Min, search_tree_in_gaa(Left, Min, Max))
search_tree_in_gaa(tree(X, Left, Right), Min1, Max2) → U6_gaa(X, Left, Right, Min1, Max2, search_tree_in_gaa(Left, Min1, Max1))
U6_gaa(X, Left, Right, Min1, Max2, search_tree_out_gaa(Left, Min1, Max1)) → U7_gaa(X, Left, Right, Min1, Max2, Max1, less_in_gg(Max1, X))
less_in_gg(0, s(X)) → less_out_gg(0, s(X))
less_in_gg(s(X), s(Y)) → U10_gg(X, Y, less_in_gg(X, Y))
U10_gg(X, Y, less_out_gg(X, Y)) → less_out_gg(s(X), s(Y))
U7_gaa(X, Left, Right, Min1, Max2, Max1, less_out_gg(Max1, X)) → U8_gaa(X, Left, Right, Min1, Max2, search_tree_in_gaa(Right, Min2, Max2))
U8_gaa(X, Left, Right, Min1, Max2, search_tree_out_gaa(Right, Min2, Max2)) → U9_gaa(X, Left, Right, Min1, Max2, less_in_gg(X, Min2))
U9_gaa(X, Left, Right, Min1, Max2, less_out_gg(X, Min2)) → search_tree_out_gaa(tree(X, Left, Right), Min1, Max2)
U4_gaa(X, Left, Min, search_tree_out_gaa(Left, Min, Max)) → U5_gaa(X, Left, Min, less_in_gg(Max, X))
U5_gaa(X, Left, Min, less_out_gg(Max, X)) → search_tree_out_gaa(tree(X, Left, void), Min, X)
U2_gaa(X, Right, Max, search_tree_out_gaa(Right, Min, Max)) → U3_gaa(X, Right, Max, less_in_gg(X, Min))
U3_gaa(X, Right, Max, less_out_gg(X, Min)) → search_tree_out_gaa(tree(X, void, Right), X, Max)
U1_g(T, search_tree_out_gaa(T, X, X1)) → search_tree_out_g(T)

The argument filtering Pi contains the following mapping:
search_tree_in_g(x1)  =  search_tree_in_g(x1)
void  =  void
search_tree_out_g(x1)  =  search_tree_out_g
U1_g(x1, x2)  =  U1_g(x2)
search_tree_in_gaa(x1, x2, x3)  =  search_tree_in_gaa(x1)
tree(x1, x2, x3)  =  tree(x1, x2, x3)
search_tree_out_gaa(x1, x2, x3)  =  search_tree_out_gaa(x2, x3)
U2_gaa(x1, x2, x3, x4)  =  U2_gaa(x1, x4)
U4_gaa(x1, x2, x3, x4)  =  U4_gaa(x1, x4)
U6_gaa(x1, x2, x3, x4, x5, x6)  =  U6_gaa(x1, x3, x6)
U7_gaa(x1, x2, x3, x4, x5, x6, x7)  =  U7_gaa(x1, x3, x4, x7)
less_in_gg(x1, x2)  =  less_in_gg(x1, x2)
0  =  0
s(x1)  =  s(x1)
less_out_gg(x1, x2)  =  less_out_gg
U10_gg(x1, x2, x3)  =  U10_gg(x3)
U8_gaa(x1, x2, x3, x4, x5, x6)  =  U8_gaa(x1, x4, x6)
U9_gaa(x1, x2, x3, x4, x5, x6)  =  U9_gaa(x4, x5, x6)
U5_gaa(x1, x2, x3, x4)  =  U5_gaa(x1, x3, x4)
U3_gaa(x1, x2, x3, x4)  =  U3_gaa(x1, x3, x4)
SEARCH_TREE_IN_G(x1)  =  SEARCH_TREE_IN_G(x1)
U7_GAA(x1, x2, x3, x4, x5, x6, x7)  =  U7_GAA(x1, x3, x4, x7)
U3_GAA(x1, x2, x3, x4)  =  U3_GAA(x1, x3, x4)
U1_G(x1, x2)  =  U1_G(x2)
U4_GAA(x1, x2, x3, x4)  =  U4_GAA(x1, x4)
U8_GAA(x1, x2, x3, x4, x5, x6)  =  U8_GAA(x1, x4, x6)
U9_GAA(x1, x2, x3, x4, x5, x6)  =  U9_GAA(x4, x5, x6)
U5_GAA(x1, x2, x3, x4)  =  U5_GAA(x1, x3, x4)
LESS_IN_GG(x1, x2)  =  LESS_IN_GG(x1, x2)
U6_GAA(x1, x2, x3, x4, x5, x6)  =  U6_GAA(x1, x3, x6)
U10_GG(x1, x2, x3)  =  U10_GG(x3)
SEARCH_TREE_IN_GAA(x1, x2, x3)  =  SEARCH_TREE_IN_GAA(x1)
U2_GAA(x1, x2, x3, x4)  =  U2_GAA(x1, x4)

We have to consider all (P,R,Pi)-chains
The approximation of the Dependency Graph [30] contains 2 SCCs with 13 less nodes.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
PiDP
                ↳ UsableRulesProof
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

LESS_IN_GG(s(X), s(Y)) → LESS_IN_GG(X, Y)

The TRS R consists of the following rules:

search_tree_in_g(void) → search_tree_out_g(void)
search_tree_in_g(T) → U1_g(T, search_tree_in_gaa(T, X, X1))
search_tree_in_gaa(tree(X, void, void), X, X) → search_tree_out_gaa(tree(X, void, void), X, X)
search_tree_in_gaa(tree(X, void, Right), X, Max) → U2_gaa(X, Right, Max, search_tree_in_gaa(Right, Min, Max))
search_tree_in_gaa(tree(X, Left, void), Min, X) → U4_gaa(X, Left, Min, search_tree_in_gaa(Left, Min, Max))
search_tree_in_gaa(tree(X, Left, Right), Min1, Max2) → U6_gaa(X, Left, Right, Min1, Max2, search_tree_in_gaa(Left, Min1, Max1))
U6_gaa(X, Left, Right, Min1, Max2, search_tree_out_gaa(Left, Min1, Max1)) → U7_gaa(X, Left, Right, Min1, Max2, Max1, less_in_gg(Max1, X))
less_in_gg(0, s(X)) → less_out_gg(0, s(X))
less_in_gg(s(X), s(Y)) → U10_gg(X, Y, less_in_gg(X, Y))
U10_gg(X, Y, less_out_gg(X, Y)) → less_out_gg(s(X), s(Y))
U7_gaa(X, Left, Right, Min1, Max2, Max1, less_out_gg(Max1, X)) → U8_gaa(X, Left, Right, Min1, Max2, search_tree_in_gaa(Right, Min2, Max2))
U8_gaa(X, Left, Right, Min1, Max2, search_tree_out_gaa(Right, Min2, Max2)) → U9_gaa(X, Left, Right, Min1, Max2, less_in_gg(X, Min2))
U9_gaa(X, Left, Right, Min1, Max2, less_out_gg(X, Min2)) → search_tree_out_gaa(tree(X, Left, Right), Min1, Max2)
U4_gaa(X, Left, Min, search_tree_out_gaa(Left, Min, Max)) → U5_gaa(X, Left, Min, less_in_gg(Max, X))
U5_gaa(X, Left, Min, less_out_gg(Max, X)) → search_tree_out_gaa(tree(X, Left, void), Min, X)
U2_gaa(X, Right, Max, search_tree_out_gaa(Right, Min, Max)) → U3_gaa(X, Right, Max, less_in_gg(X, Min))
U3_gaa(X, Right, Max, less_out_gg(X, Min)) → search_tree_out_gaa(tree(X, void, Right), X, Max)
U1_g(T, search_tree_out_gaa(T, X, X1)) → search_tree_out_g(T)

The argument filtering Pi contains the following mapping:
search_tree_in_g(x1)  =  search_tree_in_g(x1)
void  =  void
search_tree_out_g(x1)  =  search_tree_out_g
U1_g(x1, x2)  =  U1_g(x2)
search_tree_in_gaa(x1, x2, x3)  =  search_tree_in_gaa(x1)
tree(x1, x2, x3)  =  tree(x1, x2, x3)
search_tree_out_gaa(x1, x2, x3)  =  search_tree_out_gaa(x2, x3)
U2_gaa(x1, x2, x3, x4)  =  U2_gaa(x1, x4)
U4_gaa(x1, x2, x3, x4)  =  U4_gaa(x1, x4)
U6_gaa(x1, x2, x3, x4, x5, x6)  =  U6_gaa(x1, x3, x6)
U7_gaa(x1, x2, x3, x4, x5, x6, x7)  =  U7_gaa(x1, x3, x4, x7)
less_in_gg(x1, x2)  =  less_in_gg(x1, x2)
0  =  0
s(x1)  =  s(x1)
less_out_gg(x1, x2)  =  less_out_gg
U10_gg(x1, x2, x3)  =  U10_gg(x3)
U8_gaa(x1, x2, x3, x4, x5, x6)  =  U8_gaa(x1, x4, x6)
U9_gaa(x1, x2, x3, x4, x5, x6)  =  U9_gaa(x4, x5, x6)
U5_gaa(x1, x2, x3, x4)  =  U5_gaa(x1, x3, x4)
U3_gaa(x1, x2, x3, x4)  =  U3_gaa(x1, x3, x4)
LESS_IN_GG(x1, x2)  =  LESS_IN_GG(x1, x2)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

LESS_IN_GG(s(X), s(Y)) → LESS_IN_GG(X, Y)

R is empty.
Pi is empty.
We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ QDPSizeChangeProof
              ↳ PiDP

Q DP problem:
The TRS P consists of the following rules:

LESS_IN_GG(s(X), s(Y)) → LESS_IN_GG(X, Y)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
PiDP
                ↳ UsableRulesProof

Pi DP problem:
The TRS P consists of the following rules:

U7_GAA(X, Left, Right, Min1, Max2, Max1, less_out_gg(Max1, X)) → SEARCH_TREE_IN_GAA(Right, Min2, Max2)
SEARCH_TREE_IN_GAA(tree(X, void, Right), X, Max) → SEARCH_TREE_IN_GAA(Right, Min, Max)
SEARCH_TREE_IN_GAA(tree(X, Left, void), Min, X) → SEARCH_TREE_IN_GAA(Left, Min, Max)
SEARCH_TREE_IN_GAA(tree(X, Left, Right), Min1, Max2) → SEARCH_TREE_IN_GAA(Left, Min1, Max1)
U6_GAA(X, Left, Right, Min1, Max2, search_tree_out_gaa(Left, Min1, Max1)) → U7_GAA(X, Left, Right, Min1, Max2, Max1, less_in_gg(Max1, X))
SEARCH_TREE_IN_GAA(tree(X, Left, Right), Min1, Max2) → U6_GAA(X, Left, Right, Min1, Max2, search_tree_in_gaa(Left, Min1, Max1))

The TRS R consists of the following rules:

search_tree_in_g(void) → search_tree_out_g(void)
search_tree_in_g(T) → U1_g(T, search_tree_in_gaa(T, X, X1))
search_tree_in_gaa(tree(X, void, void), X, X) → search_tree_out_gaa(tree(X, void, void), X, X)
search_tree_in_gaa(tree(X, void, Right), X, Max) → U2_gaa(X, Right, Max, search_tree_in_gaa(Right, Min, Max))
search_tree_in_gaa(tree(X, Left, void), Min, X) → U4_gaa(X, Left, Min, search_tree_in_gaa(Left, Min, Max))
search_tree_in_gaa(tree(X, Left, Right), Min1, Max2) → U6_gaa(X, Left, Right, Min1, Max2, search_tree_in_gaa(Left, Min1, Max1))
U6_gaa(X, Left, Right, Min1, Max2, search_tree_out_gaa(Left, Min1, Max1)) → U7_gaa(X, Left, Right, Min1, Max2, Max1, less_in_gg(Max1, X))
less_in_gg(0, s(X)) → less_out_gg(0, s(X))
less_in_gg(s(X), s(Y)) → U10_gg(X, Y, less_in_gg(X, Y))
U10_gg(X, Y, less_out_gg(X, Y)) → less_out_gg(s(X), s(Y))
U7_gaa(X, Left, Right, Min1, Max2, Max1, less_out_gg(Max1, X)) → U8_gaa(X, Left, Right, Min1, Max2, search_tree_in_gaa(Right, Min2, Max2))
U8_gaa(X, Left, Right, Min1, Max2, search_tree_out_gaa(Right, Min2, Max2)) → U9_gaa(X, Left, Right, Min1, Max2, less_in_gg(X, Min2))
U9_gaa(X, Left, Right, Min1, Max2, less_out_gg(X, Min2)) → search_tree_out_gaa(tree(X, Left, Right), Min1, Max2)
U4_gaa(X, Left, Min, search_tree_out_gaa(Left, Min, Max)) → U5_gaa(X, Left, Min, less_in_gg(Max, X))
U5_gaa(X, Left, Min, less_out_gg(Max, X)) → search_tree_out_gaa(tree(X, Left, void), Min, X)
U2_gaa(X, Right, Max, search_tree_out_gaa(Right, Min, Max)) → U3_gaa(X, Right, Max, less_in_gg(X, Min))
U3_gaa(X, Right, Max, less_out_gg(X, Min)) → search_tree_out_gaa(tree(X, void, Right), X, Max)
U1_g(T, search_tree_out_gaa(T, X, X1)) → search_tree_out_g(T)

The argument filtering Pi contains the following mapping:
search_tree_in_g(x1)  =  search_tree_in_g(x1)
void  =  void
search_tree_out_g(x1)  =  search_tree_out_g
U1_g(x1, x2)  =  U1_g(x2)
search_tree_in_gaa(x1, x2, x3)  =  search_tree_in_gaa(x1)
tree(x1, x2, x3)  =  tree(x1, x2, x3)
search_tree_out_gaa(x1, x2, x3)  =  search_tree_out_gaa(x2, x3)
U2_gaa(x1, x2, x3, x4)  =  U2_gaa(x1, x4)
U4_gaa(x1, x2, x3, x4)  =  U4_gaa(x1, x4)
U6_gaa(x1, x2, x3, x4, x5, x6)  =  U6_gaa(x1, x3, x6)
U7_gaa(x1, x2, x3, x4, x5, x6, x7)  =  U7_gaa(x1, x3, x4, x7)
less_in_gg(x1, x2)  =  less_in_gg(x1, x2)
0  =  0
s(x1)  =  s(x1)
less_out_gg(x1, x2)  =  less_out_gg
U10_gg(x1, x2, x3)  =  U10_gg(x3)
U8_gaa(x1, x2, x3, x4, x5, x6)  =  U8_gaa(x1, x4, x6)
U9_gaa(x1, x2, x3, x4, x5, x6)  =  U9_gaa(x4, x5, x6)
U5_gaa(x1, x2, x3, x4)  =  U5_gaa(x1, x3, x4)
U3_gaa(x1, x2, x3, x4)  =  U3_gaa(x1, x3, x4)
U7_GAA(x1, x2, x3, x4, x5, x6, x7)  =  U7_GAA(x1, x3, x4, x7)
U6_GAA(x1, x2, x3, x4, x5, x6)  =  U6_GAA(x1, x3, x6)
SEARCH_TREE_IN_GAA(x1, x2, x3)  =  SEARCH_TREE_IN_GAA(x1)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof

Pi DP problem:
The TRS P consists of the following rules:

U7_GAA(X, Left, Right, Min1, Max2, Max1, less_out_gg(Max1, X)) → SEARCH_TREE_IN_GAA(Right, Min2, Max2)
SEARCH_TREE_IN_GAA(tree(X, void, Right), X, Max) → SEARCH_TREE_IN_GAA(Right, Min, Max)
SEARCH_TREE_IN_GAA(tree(X, Left, void), Min, X) → SEARCH_TREE_IN_GAA(Left, Min, Max)
SEARCH_TREE_IN_GAA(tree(X, Left, Right), Min1, Max2) → SEARCH_TREE_IN_GAA(Left, Min1, Max1)
U6_GAA(X, Left, Right, Min1, Max2, search_tree_out_gaa(Left, Min1, Max1)) → U7_GAA(X, Left, Right, Min1, Max2, Max1, less_in_gg(Max1, X))
SEARCH_TREE_IN_GAA(tree(X, Left, Right), Min1, Max2) → U6_GAA(X, Left, Right, Min1, Max2, search_tree_in_gaa(Left, Min1, Max1))

The TRS R consists of the following rules:

less_in_gg(0, s(X)) → less_out_gg(0, s(X))
less_in_gg(s(X), s(Y)) → U10_gg(X, Y, less_in_gg(X, Y))
search_tree_in_gaa(tree(X, void, void), X, X) → search_tree_out_gaa(tree(X, void, void), X, X)
search_tree_in_gaa(tree(X, void, Right), X, Max) → U2_gaa(X, Right, Max, search_tree_in_gaa(Right, Min, Max))
search_tree_in_gaa(tree(X, Left, void), Min, X) → U4_gaa(X, Left, Min, search_tree_in_gaa(Left, Min, Max))
search_tree_in_gaa(tree(X, Left, Right), Min1, Max2) → U6_gaa(X, Left, Right, Min1, Max2, search_tree_in_gaa(Left, Min1, Max1))
U10_gg(X, Y, less_out_gg(X, Y)) → less_out_gg(s(X), s(Y))
U2_gaa(X, Right, Max, search_tree_out_gaa(Right, Min, Max)) → U3_gaa(X, Right, Max, less_in_gg(X, Min))
U4_gaa(X, Left, Min, search_tree_out_gaa(Left, Min, Max)) → U5_gaa(X, Left, Min, less_in_gg(Max, X))
U6_gaa(X, Left, Right, Min1, Max2, search_tree_out_gaa(Left, Min1, Max1)) → U7_gaa(X, Left, Right, Min1, Max2, Max1, less_in_gg(Max1, X))
U3_gaa(X, Right, Max, less_out_gg(X, Min)) → search_tree_out_gaa(tree(X, void, Right), X, Max)
U5_gaa(X, Left, Min, less_out_gg(Max, X)) → search_tree_out_gaa(tree(X, Left, void), Min, X)
U7_gaa(X, Left, Right, Min1, Max2, Max1, less_out_gg(Max1, X)) → U8_gaa(X, Left, Right, Min1, Max2, search_tree_in_gaa(Right, Min2, Max2))
U8_gaa(X, Left, Right, Min1, Max2, search_tree_out_gaa(Right, Min2, Max2)) → U9_gaa(X, Left, Right, Min1, Max2, less_in_gg(X, Min2))
U9_gaa(X, Left, Right, Min1, Max2, less_out_gg(X, Min2)) → search_tree_out_gaa(tree(X, Left, Right), Min1, Max2)

The argument filtering Pi contains the following mapping:
void  =  void
search_tree_in_gaa(x1, x2, x3)  =  search_tree_in_gaa(x1)
tree(x1, x2, x3)  =  tree(x1, x2, x3)
search_tree_out_gaa(x1, x2, x3)  =  search_tree_out_gaa(x2, x3)
U2_gaa(x1, x2, x3, x4)  =  U2_gaa(x1, x4)
U4_gaa(x1, x2, x3, x4)  =  U4_gaa(x1, x4)
U6_gaa(x1, x2, x3, x4, x5, x6)  =  U6_gaa(x1, x3, x6)
U7_gaa(x1, x2, x3, x4, x5, x6, x7)  =  U7_gaa(x1, x3, x4, x7)
less_in_gg(x1, x2)  =  less_in_gg(x1, x2)
0  =  0
s(x1)  =  s(x1)
less_out_gg(x1, x2)  =  less_out_gg
U10_gg(x1, x2, x3)  =  U10_gg(x3)
U8_gaa(x1, x2, x3, x4, x5, x6)  =  U8_gaa(x1, x4, x6)
U9_gaa(x1, x2, x3, x4, x5, x6)  =  U9_gaa(x4, x5, x6)
U5_gaa(x1, x2, x3, x4)  =  U5_gaa(x1, x3, x4)
U3_gaa(x1, x2, x3, x4)  =  U3_gaa(x1, x3, x4)
U7_GAA(x1, x2, x3, x4, x5, x6, x7)  =  U7_GAA(x1, x3, x4, x7)
U6_GAA(x1, x2, x3, x4, x5, x6)  =  U6_GAA(x1, x3, x6)
SEARCH_TREE_IN_GAA(x1, x2, x3)  =  SEARCH_TREE_IN_GAA(x1)

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ QDPSizeChangeProof

Q DP problem:
The TRS P consists of the following rules:

U7_GAA(X, Right, Min1, less_out_gg) → SEARCH_TREE_IN_GAA(Right)
U6_GAA(X, Right, search_tree_out_gaa(Min1, Max1)) → U7_GAA(X, Right, Min1, less_in_gg(Max1, X))
SEARCH_TREE_IN_GAA(tree(X, Left, Right)) → SEARCH_TREE_IN_GAA(Left)
SEARCH_TREE_IN_GAA(tree(X, Left, Right)) → U6_GAA(X, Right, search_tree_in_gaa(Left))
SEARCH_TREE_IN_GAA(tree(X, Left, void)) → SEARCH_TREE_IN_GAA(Left)
SEARCH_TREE_IN_GAA(tree(X, void, Right)) → SEARCH_TREE_IN_GAA(Right)

The TRS R consists of the following rules:

less_in_gg(0, s(X)) → less_out_gg
less_in_gg(s(X), s(Y)) → U10_gg(less_in_gg(X, Y))
search_tree_in_gaa(tree(X, void, void)) → search_tree_out_gaa(X, X)
search_tree_in_gaa(tree(X, void, Right)) → U2_gaa(X, search_tree_in_gaa(Right))
search_tree_in_gaa(tree(X, Left, void)) → U4_gaa(X, search_tree_in_gaa(Left))
search_tree_in_gaa(tree(X, Left, Right)) → U6_gaa(X, Right, search_tree_in_gaa(Left))
U10_gg(less_out_gg) → less_out_gg
U2_gaa(X, search_tree_out_gaa(Min, Max)) → U3_gaa(X, Max, less_in_gg(X, Min))
U4_gaa(X, search_tree_out_gaa(Min, Max)) → U5_gaa(X, Min, less_in_gg(Max, X))
U6_gaa(X, Right, search_tree_out_gaa(Min1, Max1)) → U7_gaa(X, Right, Min1, less_in_gg(Max1, X))
U3_gaa(X, Max, less_out_gg) → search_tree_out_gaa(X, Max)
U5_gaa(X, Min, less_out_gg) → search_tree_out_gaa(Min, X)
U7_gaa(X, Right, Min1, less_out_gg) → U8_gaa(X, Min1, search_tree_in_gaa(Right))
U8_gaa(X, Min1, search_tree_out_gaa(Min2, Max2)) → U9_gaa(Min1, Max2, less_in_gg(X, Min2))
U9_gaa(Min1, Max2, less_out_gg) → search_tree_out_gaa(Min1, Max2)

The set Q consists of the following terms:

less_in_gg(x0, x1)
search_tree_in_gaa(x0)
U10_gg(x0)
U2_gaa(x0, x1)
U4_gaa(x0, x1)
U6_gaa(x0, x1, x2)
U3_gaa(x0, x1, x2)
U5_gaa(x0, x1, x2)
U7_gaa(x0, x1, x2, x3)
U8_gaa(x0, x1, x2)
U9_gaa(x0, x1, x2)

We have to consider all (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs: